package com.fit.pages.organization;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.dao.contactPerson.ContactPersonDAO;
import com.fit.dao.organization.OrganizationDAO;
import com.fit.entities.ContactPerson;
import com.fit.entities.Organization;
import com.fit.pages.Confirmation;

public class MoreInfo {

	@Property
	@Persist
	private Organization organization;
	@Property
	@Persist
	private ContactPerson contactPerson;


	@Inject
	private ContactPersonDAO contactPersonDAO;

	@Inject
	private OrganizationDAO organizationDAO;

	@InjectPage
	private Confirmation confirmation;

	Object onActivate(Long id) {
		organization = organizationDAO.findByID(id);
		contactPerson = contactPersonDAO.findByID(organization
				.getContactPerson().getId());

		if (organization == null) {
			confirmation.setError("Greska prilikom prikaza zapisa korisnika! ");
			return confirmation;
		}
		return null;
	}

}
